<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>发送AJAX请求</title>
    <script src="js/vue.js"></script>
    <script src="js/axios.min.js"></script>
    <script>
        window.onload = function () {
            var vm = new Vue({
                el: '#app',
                methods:{
                    send(){
                        axios({
                            method:'get',
                            url:'testFile/user.json'
                        })
                        .then(resp =>{  //请求成功
                            console.log(resp.data);
                        }).catch(resp=>{ //请求失败
                            console.log(resp);
                        });
                    }
                }
            })
        }
    </script>
</head>

<body>
    <div id="app">
        <button @click="send">发送AJAX请求</button>
        </div>
</body>

</html>